package lab03.test07;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class Test07 {
    public static void main(String[] args) {
        String path = "D:\\Test.zip";

        ZipInputStream zipInputStream = null;
        try {
             zipInputStream = new ZipInputStream(
                    new FileInputStream(path)
            );//实例化

            ZipEntry entry;

            try {
                while((entry = zipInputStream.getNextEntry()) != null){
                    System.out.println(entry.getName());
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }finally {
            try {
                zipInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
